<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<base href="/tpshop/" />
	<title>京东(JD.COM)-综合网购首选-正品低价、品质保障、配送及时、轻松购物！</title>
	<link rel="stylesheet" href="/tpshop/Public/css/bootstrap.min.css">
	<link rel="stylesheet" href="/tpshop/Public/css/bootstrap-theme.min.css">
	<link rel="stylesheet" href="/tpshop/Public/css/front.css">
	<link rel="stylesheet" href="/tpshop/Public/css/nivo-slider.css">
	
</head>
<body id="product_lists">
	<div class="container">
		<div class="row" id="header" >
	<div class="col-md-3">
		<a href="/tpshop/index.php"><img id="logo" src="/tpshop/Public/img/logo.png" /></a>
	</div>
	<div class="col-md-6">
		<p id="contact"><i class="glyphicon glyphicon-phone-alt"></i>400-12345678910<i class="glyphicon glyphicon-envelope"></i>onlyallure@163.com</p>
		<div class="input-group">
			<input type="text" class="form-control" placeholder="请输入商品名称或店铺...">
			<span class="input-group-btn">
				<button class="btn btn-danger" type="button">搜索</button>
			</span>
		</div>
	</div>
	<div class="col-md-3">
		<div class="login_info">
			<?php if($_SESSION['user_is_login']){?>
				<span>欢迎回来,<?=$_SESSION['username']?></span><a href="<?=U('user/logout')?>">退出</a>
				<?php }else{?>
					<a href="<?=U("user/login")?>">立即登录</a>
					<a href="<?=U('user/regedit')?>">立即注册</a>
				<?php }?>
		</div>
		<a href="<?=U('shopping/cartlist')?>" id="shopcart" class="pull-right">
		
			<i class="glyphicon glyphicon-shopping-cart"></i>我的购物车
			<?php if($_SESSION['user_is_login']){?>
			<span>1</span>
			<?php }?>
		</a> 
	</div>
</div>
		<br /><br />
		<div class="row">
			<div class="col-sm-3">
				<div id="product_menu">
					<div id="product_menu_title">
						<a href="#" class="navbar-link"><i class="glyphicon glyphicon-menu-hamburger"></i><?=$parent_catalog['name']?></a>
					</div>
					<ul>
					<?php foreach($brother_catalogs as $c){?>
						<li <?php if($c['id'] == $catalog['id']){?> class="active" <?php }?>><a href="<?=U('Home/product/lists/',array('cataid'=>$c['id']))?>"><?=$c['name']?></a></li>
						<?php }?>
					</ul>
				</div>
			</div>
			<div class="col-sm-9">
				<div class="row">
					<div id="brands" class="col-md-12">
						<?php foreach($brands as $b){?>
							<a <?php if($b['id'] == $brand_id['id']){?> class="active" <?php }?> href="<?php echo U()."/cataid/".$catalog['id']."?brand=". $b['id']?>"><?=$b['name']?></a>
						<?php }?>
					</div>
				</div>
				<div class="row">
					<?php foreach($products as $p){?>
						<div class="col-md-3 product_item">
							<img class="product_item_img" src="/tpshop<?=$p['img']?>">
							<?php $imgs = M('product_img')->where('product_id ='.$p['id'])->limit(4)->select();?>
							<ul class="clearfix">
								<?php foreach($imgs as $img){?>
								<li><img src="/tpshop<?=$img['url']?>"></li>
								<?php }?>
							</ul>
							<h5><a href="<?=U('home/product/detail/',array('id'=>$p['id']))?>"><?=$p['title']?></a></h5>
							<p class="price">¥<?=$p['price']?></p>
							<a href="<?=U('home/product/detail/',array('id'=>$p['id']))?>" class="btn btn-danger">立即购买</a>
						</div>
					<?php }?>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="/tpshop/Public/js/jquery-3.1.0.min.js"></script>
	<script type="text/javascript">
	    $(function(){
		    $('.product_item ul li').mouseover(function(){
		    	$(this).parents('.product_item').find('ul li').removeClass("hover");
		    	$(this).addClass('hover');  
		    	var src = $(this).find('img').attr('src');
		    	$(this).parents('.product_item').find('.product_item_img').attr('src',src);	
		    })
		});
	</script>
</body>
</html>